package com.wc.算法基础课.A第一讲基础算法.贡献法.牛的基因学;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/3/9 11:44
 * @description https://www.acwing.com/problem/content/5157/
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 100010;
    static int[] cnt = new int[130];
    static int n;
    static char[] cs;
    static int P = 1000000007;

    // 每个字母的贡献最大就是字母出现最多次的个数
    public static void main(String[] args) {
        n = sc.nextInt();
        cs = sc.next().toCharArray();
        for (char c : cs) {
            cnt[c]++;
        }
        int maxV = 0;
        // 记录最大值的数量
        int num = 0;
        char[] les = new char[]{'A', 'C', 'G', 'T'};
        for (char le : les) {
            maxV = Math.max(maxV, cnt[le]);
        }
        for (char le : les) {
            if (maxV == cnt[le]) num++;
        }
        long res = 1;
        for (int i = 1; i <= n; i++) {
            res = res * num % P;
        }
        out.println(res);
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}